/*
 * Copyright (c) 2007, TopCoder, Inc. All rights reserved.
 */

using System;
using TopCoder.Util.Calendar.Entry;

namespace TopCoder.WinForms.Controls.CalendarView.Views
{
    /// <summary>
    /// <para>A type of <see cref="PopupPanel"/> that displays one <see cref="CalendarEntry"/> popup,
    /// assuming data is truncated.</para>
    /// <para>It forms a base class for all popups that have to display some information about the entry
    /// when that information is truncated.</para>
    /// </summary>
    /// <remarks>Thread Safety: This class is immutable and thread-safe.</remarks>
    /// <author>Ghostar</author>
    /// <author>yext</author>
    /// <author>argolite</author>
    /// <author>alex.dolin</author>
    /// <version>1.1</version>
    /// <copyright>Copyright (c) 2007, TopCoder, Inc. All rights reserved.</copyright>
    public abstract class CalendarEntryPopupPanel : PopupPanel
    {
        /// <summary>
        /// Represents the entry for this panel. It will not be null.
        /// </summary>
        private readonly CalendarEntry entry;

        /// <summary>
        /// Represents the flag as to whether the data is truncated.
        /// This will determine if popup is in effect.
        /// </summary>
        private bool truncated;

        /// <summary>
        /// Represents the entry for this panel. It will not be null.
        /// </summary>
        /// <value>The entry for this panel.</value>
        public CalendarEntry Entry
        {
            get
            {
                return entry;
            }
        }

        /// <summary>
        /// Represents the flag as to whether the data is truncated.
        /// This will determine if popup is in effect.
        /// </summary>
        /// <value>The flag whether the data is truncated.</value>
        public bool Truncated
        {
            get
            {
                return truncated;
            }
            set
            {
                truncated = value;
            }
        }

        /// <summary>
        /// Creates a new instance of this class.
        /// </summary>
        /// <param name="entry">The entry for this panel.</param>
        /// <param name="truncated">The flag whether the data is truncated.</param>
        /// <param name="calendarView">The parent calendar view.</param>
        /// <param name="destinationViewName">The destination view's name
        /// for the calendar view control.</param>
        /// <param name="dateOfInterest">The date around which to wrap the destination view.</param>
        /// <exception cref="ArgumentNullException">If <paramref name="entry"/>
        /// or <paramref name="calendarView"/> is null.</exception>
        protected CalendarEntryPopupPanel(CalendarEntry entry, bool truncated, AbstractCalendarView calendarView,
                                          string destinationViewName, DateTime dateOfInterest)
            : base(calendarView, destinationViewName, dateOfInterest)
        {
            if (entry == null)
            {
                throw new ArgumentNullException("entry", "Argument entry should not be null.");
            }

            this.entry = entry;
            this.truncated = truncated;
        }
    }
}